<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>hls.js demo</title>
</head>
<body>

    <video controls id="vid"></video>

    
    <script src="https://cdn.bootcss.com/hls.js/0.12.4/hls.js"></script>
    <script>
        function urlValueToDom () {
            const query = location.search.substr(1)
            const obj = {}


            query.split('&').map(function (pair) {
                const arr = pair.split('=')
                obj[arr[0]] = decodeURIComponent(arr[1])
            })
            return obj
        }
    </script>
    <script>
        
        var video = document.getElementById('vid')

        const query = urlValueToDom()
        var stream = query.stream
        if (!stream) {
            alert('stream not found')
        }

        var hls = new Hls({debug: true});
        hls.loadSource(stream);
        hls.attachMedia(video);
        hls.on(Hls.Events.MANIFEST_PARSED,function() {
            video.play();
        });
    </script>
</body>
</html>